// 封装购物车相关的接口
import requests from "@/utils/request";
import user from "@/store/user";

// 加入购物车接口 /member/cart  post
export const insertCartAPI = (skuId,count) => requests({url:'/card/'+user.state.userInfo.id,method:'post',data:{medicineId:skuId,sum:count}})

// 获取购物车列表接口  /member/cart  get
export const findNewCartListAPI = () => requests({url:'/card/select/list?id='+user.state.userInfo.id,method:'get'})

// 删除购物车的接口  /member/cart delete
// export const deleteCartAPI = (ids) =>requests({url:'/card/'+ids,method:'delete',data:{ids}})
export const deleteCartAPI = (ids) =>requests({url:'/card/'+ids,method:'delete'})

// 合并购物车接口 /member/cart/merge
export const mergeCartAPI = (data) => requests({url:'/member/cart/merge',method:'post',data})

export const updateCartAPI = (data) => requests({url:'/card',method:'put',data:data})

export const updateAllAPI = (data) => requests({url:'/card/all/'+data.selected,method:'put'})
